package cn.wbnyua.msm.web.dao;

import cn.wbnyua.msm.web.domain.Goods;
import cn.wbnyua.msm.web.domain.Staff;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/8 22:56.
 */

@Mapper
public interface StaffMapper {
    @Select("select * from staff")
    List<Staff> findAll();
    @Select("select * from staff where id = #{id}")
    Staff findById(Long id);

    @Insert("INSERT INTO `msm`.`staff` (`account`, `password`, `name`, `age`, `mobile`, `salary`, `entry_time`)" +
            " VALUES (#{account}, #{password}, #{name}, #{age}, #{mobile}, #{salary}, #{entryTime})")
    int add(Staff staff);

    @Update("UPDATE `msm`.`staff` SET `account` = '#{account}'," +
            " `password` = '#{password}', `name` = '#{name}', " +
            "`age` = '#{age}', `mobile` = '#{mobile}'," +
            " `salary` = '#{salary}', `enrty_time` = '#{enrtyTime}' WHERE `id` = #{id}")
    int update(Staff staff);

    @Delete("delete from staff where id = #{id}")
    int remove(Long id);
}
